/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package enteties.person;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Gebruiker
 */
@Entity
@Table(name = "telecom")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Telecom.findAll", query = "SELECT t FROM Telecom t"),
    @NamedQuery(name = "Telecom.findById", query = "SELECT t FROM Telecom t WHERE t.id = :id"),
    @NamedQuery(name = "Telecom.findByValue", query = "SELECT t FROM Telecom t WHERE t.value = :value")})
public class Telecom implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 45)
    @Column(name = "value")
    private String value;
    @JoinColumn(name = "Supplier_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Supplier supplierid;
    @JoinColumn(name = "TelecomType_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Telecomtype telecomTypeid;

    public Telecom() {
    }
    
    public Telecom(String value, Telecomtype type, Supplier supplier){
        this.value = value;
        this.telecomTypeid = type;
        this.supplierid = supplier;
    }

    public Telecom(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public Supplier getSupplierid() {
        return supplierid;
    }

    public void setSupplierid(Supplier supplierid) {
        this.supplierid = supplierid;
    }

    public Telecomtype getTelecomTypeid() {
        return telecomTypeid;
    }

    public void setTelecomTypeid(Telecomtype telecomTypeid) {
        this.telecomTypeid = telecomTypeid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Telecom)) {
            return false;
        }
        Telecom other = (Telecom) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "enteties.person.Telecom[ id=" + id + " ]";
    }
    
}
